home *** CD-ROM | disk | FTP | other *** search
- /*
- SpeedswitchXP V1.5
- - Windows XP CPU Frequency Control for Notebooks -
-
- Copyright(c) 2002-2005 Christian Diefer
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License version 2 as
- published by the Free Software Foundation.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
- #ifndef SPEEDSWITCH_H
- #define SPEEDSWITCH_H
-
- extern "C" {
- #include <windows.h>
- #include <winnt.h>
- #include <powrprof.h>
- };
-
- typedef struct _PROCESSOR_POWER_INFORMATION {
- ULONG Number;
- ULONG MaxMhz;
- ULONG CurrentMhz;
- ULONG MhzLimit;
- ULONG MaxIdleState;
- ULONG CurrentIdleState;
- } PROCESSOR_POWER_INFORMATION , *PPROCESSOR_POWER_INFORMATION ;
-
- extern char* uc2char( char* dest, void* s ); // unicode to ansi (char*)
- extern char* char2uc( char* dest, char* s ); // ansi (char*) to unicode
-
- int detectProfile();
- int createProfile();
- void updateStates();
- BOOL setState( BOOL ac, BYTE policy );
- CString throttleString( UCHAR throttle ); // CPU throttle state to string
- CString sysPwrState( SYSTEM_POWER_STATE state ); // power state to string
- CString pwrAction( POWER_ACTION action ); // power action to string
- DWORD cpuUsageNT();
- int writePolicies( BOOL power, BOOL cpu );
- BOOL checkProfile( int check );
-
- extern int acThrottle;
- extern int dcThrottle;
- extern POWER_POLICY internalPolicy; // our own profile policy
- extern MACHINE_PROCESSOR_POWER_POLICY mach; // our own cpu policy
-
- #define SystemBasicInformation 0
- #define SystemPerformanceInformation 2
- #define SystemTimeInformation 3
-
- #define Li2Double(x) ((double)((x).HighPart) * 4.294967296E9 + (double)((x).LowPart))
-
- typedef struct
- {
- DWORD dwUnknown1;
- ULONG uKeMaximumIncrement;
- ULONG uPageSize;
- ULONG uMmNumberOfPhysicalPages;
- ULONG uMmLowestPhysicalPage;
- ULONG uMmHighestPhysicalPage;
- ULONG uAllocationGranularity;
- PVOID pLowestUserAddress;
- PVOID pMmHighestUserAddress;
- ULONG uKeActiveProcessors;
- BYTE bKeNumberProcessors;
- BYTE bUnknown2;
- WORD wUnknown3;
- } SYSTEM_BASIC_INFORMATION;
-
- typedef struct
- {
- LARGE_INTEGER liIdleTime;
- DWORD dwSpare[76];
- } SYSTEM_PERFORMANCE_INFORMATION;
-
- typedef struct
- {
- LARGE_INTEGER liKeBootTime;
- LARGE_INTEGER liKeSystemTime;
- LARGE_INTEGER liExpTimeZoneBias;
- ULONG uCurrentTimeZoneId;
- DWORD dwReserved;
- } SYSTEM_TIME_INFORMATION;
-
- typedef LONG (WINAPI *PROCNTQSI)(UINT,PVOID,ULONG,PULONG);
-
-
- #endif
-